The invention relates generally to the field of computer graphics, computer-aided geometric design and the like, and more particularly to generating a three-dimensional model of an object.
In computer graphics, computer-aided geometric design and the like, an artist, draftsman or the like (generally referred to herein as an xe2x80x9coperator) attempts to generate a three-dimensional model of an object, as maintained by a computer, from lines defining two-dimensional views of objects. Conventionally, computer-graphical arrangements generate a three-dimensional model from, for example, various two-dimensional line drawings comprising contours and/or cross-sections of the object and by applying a number of operations to such lines which will result in two-dimensional surfaces in three-dimensional space, and subsequent modification of parameters and control points of such surfaces to correct or otherwise modify the shape of the resulting model of the object. After a three-dimensional model for the object has been generated, it may be viewed or displayed in any of a number of orientations.
In a field of artificial intelligence commonly referred to as robot vision or machine vision (which will generally be referred to herein as xe2x80x9cmachine visionxe2x80x9d), a methodology referred to as xe2x80x9cshape from shadingxe2x80x9d is used to generate a three-dimensional model of an existing object from one or more two-dimensional images of the object as recorded by a camera. Generally, in machine vision, the type of the object recorded on the image(s) is initially unknown by the machine, and the model of the object that is generated is generally used to, for example, facilitate identification of the type of the object depicted on the image(s) by the machine or another device.
In the shape from shading methodology, the object to be modeled is illuminated by a light source, and a camera, such as a photographic or video camera, is used to record the image(s) from which the object will be modeled. It is assumed that the orientation of a light source, the camera position and the image plane relative to the object are known. In addition, it is assumed that the reflectance properties of the surface of the object are also known. It is further assumed that an orthographic projection technique is used to project the surface of the object onto the image plane, that is, it is assumed that an implicit camera that is recording the image on the image plane has a focal length of infinity. The image plane represents the x,y coordinate axes (that is, any point on the image plane can be identified by coordinates (x,y)), and the z axis is thus normal to the image plane; as a result, any point on the surface of the object that can be projected onto the image plane can be represented by the coordinates (x,y,z). The image of the object as projected onto the image plane is represented by an image irradiance function I(x,y) over a two-dimensional domain xcexa9⊂R2, while the shape of the object is given by a height function z(x,y) over the domain xcexa9. The image irradiance fumction I(x,y) represents the brightness of the object at each point (x,y) in the image. In the shape from shading methodology, given I(x,y) for all points (x,y) in the domain, the shape of an object, given by z(x,y), is determined.
In determining the shape of an object using the shape from shading methodology, several assumptions are made, namely,
(i) the direction of the light source is known;
(ii) the shape of the object is continuous;
(iii) the reflectance properties of the surface of the object are homogenous and known; and
(iv) the illumination over at least the portion of the surface visible in the image plane is uniform.
Under these assumptions, the image irradiance function I(x,y) for each point (x,y) on the image plane can be determined as follows. First, changes in surface orientation of the object is given by means of first partial derivatives of the height function z(x,y) with respect to both x and y,                                           p            ⁡                          (                              x                ,                y                            )                                =                                                                      ∂                                      z                    ⁡                                          (                                              x                        ,                        y                                            )                                                                                        ∂                  x                                            ⁢                              xe2x80x83                            ⁢              and              ⁢                              xe2x80x83                            ⁢                              q                ⁡                                  (                                      x                    ,                    y                                    )                                                      =                                          ∂                                  z                  ⁡                                      (                                          x                      ,                      y                                        )                                                                              ∂                y                                                    ,                            (        1        )            
where p-q space is referred to as the xe2x80x9cgradient space.xe2x80x9d Every point (p,q) of the gradient space corresponds to a particular value for the surface gradient. If the surface is continuous, values for p and q are dependent on each other since the cross-partial-derivatives have to be equal, that is:                                           ∂                          p              ⁡                              (                                  x                  ,                  y                                )                                                          ∂            y                          =                                            ∂                              q                ⁡                                  (                                      x                    ,                    y                                    )                                                                    ∂              x                                .                                    (        2        )            
(Equation (2) holds if the surface is continuous because each partial derivative represents the second partial derivative of the height function z(x,y) with respect to both x and y, and x and y are independent.) Equation (2) is referred to as the xe2x80x9cintegrability constraint,xe2x80x9d which, if it holds, will ensure that the surface is smooth and satisfies equation (1).
The relationship between the image irradiance function I(x,y) and the surface orientation (p,q) is given by a function R(p,q), which is referred to as a reflectance map
I(x,y)=R(p(x,y),q(x,y))xe2x80x83xe2x80x83(3).
Equation (3) is referred to as the xe2x80x9cimage irradiance equation.xe2x80x9d As an example, a relatively simple reflectance map exists for objects which have a Lambertian surface. A Lambertian surface appears to be equally bright from all viewing directions, with the brightness being proportional to the light flux incident on the surface. The reflection RL(p,q) is proportional to the cosine of the angle xcex1 between a direction that is normal to the surface, which is represented by the vector {right arrow over (x)} and the incident light ray direction, which is represented by the vector {right arrow over (L)}, that is,
RL(p,q)=cos xcex1={right arrow over (n)}xc2x7{right arrow over (L)}xe2x80x83xe2x80x83(4),
where {right arrow over (n)}=(p,q,1), given through p(x,y),q(x,y) and {right arrow over (L)}=(xL, yL,zL) gives the direction of the light source.
Typically, shape from shading is performed in two steps. First, the partial derivatives p and q of the height function z(x,y) are determined to get the normal information {right arrow over (n)} and in the second step the height z(x,y) is reconstructed from p and q. The partial derivatives p an q can be determined by solving the system of equations consisting of the image irradiance equation (3) and the integrability constraint equation (2). Since images can be noisy and the assumptions noted above are sometimes not perfectly satisfied, there may be no solution using this methodology, and in any case there will be no unique solution.
The invention provides a new and improved system and method for generating a three-dimensional model of an object by shading as applied by an operator or the like to a two-dimensional image of the object in the given state of its creation at any point in time.
In brief summary, the invention provides a computer graphics system for facilitating the generation of a three-dimensional model of an object in an interactive manner with an operator, such as an artist or the like. Generally, the operator will have a mental image of the object whose model is to be generated, and the operator will co-operate with the computer graphics system to develop the model. The computer graphics system will display one or more images of the object as currently modeled from rotational orientations, translational positions, and scaling or zoom settings as selected by the operator, and the operator can determine whether the object corresponds to the mental image.
In the model generation process, an initial model for the object is initialized and an image thereof is displayed to the operator by the computer graphics system. The image that is displayed will reflect a particular position of a light source and camera relative to the object, the position of the light source relative to the object defining an illumination direction, and the position of the camera relative to the object defining an image plane onto which the image of the object is projected. Any initial model, defining at least an infinitesimally small fragment of the surface for the object to be modeled, can be used, preferably occupying at least one pixel of the image plane. The initial model will identify, for the point or points on the image plane onto which the image of the surface fragment is projected, respective height values for the surface fragment defining the distance from the image plane for the surface fragment at that (those) point(s). The collection of height value(s) for the respective points on the image plane comprise a height field which defines the initial model for the object.
The initial model used in the model generation process may be one of a plurality of default models as provided by the computer graphics system itself, such as a model defining a hemi-spherical or -ellipsoid shape. Alternatively, the initial model may be provided by the operator by providing an initial shading of at least one pixel of the image plane, through an operator input device provided by the computer graphics system. If the initial model is provided by the operator, one of the points, or pixels, on the image plane is preferably selected to provide a xe2x80x9creferencexe2x80x9d portion of the initial surface fragment for the object, the reference initial surface fragment portion having a selected spatial position, rotational orientation, and height value with respect to the image plane, and the computer graphics system determines the initial model for the rest of the surface fragment (if any) in relation to shading (if any) applied to other pixels on the image plane. In one embodiment, the reference initial surface fragment portion is selected to be the portion of the surface fragment for which the first point or pixel to which the operator applies shading. In addition, in that embodiment, the reference initial surface fragment portion is determined to be parallel to the image plane, so that a vector normal thereto is orthogonal to the image plane and it has a selected height value. In any case, computer graphics system will display the image of the initial model, the image defining the shading of the object associated with the initial model as illuminated from the particular illumination direction and projected onto the image plane.
After the initial model has been developed and the image for the object associated with the initial model as projected onto the image plane has been displayed, the operator can update the shading of the image on the image plane, using, for example, a conventional pressure sensitive pen and digitizing tablet. In updating the shading, the operator can increase or reduce the shading at particular points in the image, thereby to control the brightness, or intensity values, of the image at those points. In addition, the operator can add to the surface fragment by providing shading at points on the image plane proximate those points onto which the surface fragment is currently projected. Furthermore, in an erasing mode of the shading operation, the operator can remove portions of the surface fragment by, for example, marking as unshaded the particular points on the image plane onto which the portions of the surface fragment that are to be removed are projected. After the shading of a point of the image plane has been updated, if the point is not marked as being unshaded, the computer graphics system will use the updated shading to generate an updated normal vector which identifies, for that point, the normal vector of portion of the surface of the object as projected onto the respective point, and, using the updated normal vector field and the height field, will generate an updated height field for the object. The updated normal vector field and the updated height field define the updated model of the object, which corresponds to the updated shape of the object as updated based on the shading provided by the operator.
After generating the updated model of the object, the computer graphics system can display an image of the object, as defined by the updated model, to the operator. If the updated model is satisfactory, the computer graphics system can save the updated model as the final model. On the other hand, if the updated model is not satisfactory, the operator can update the shading further. thereby to enable the computer graphics system to generate a further updated normal vector field and updated height field, thereby to generate a further updated model for the object. The computer graphics system and operator can repeat these operations until the operator determines that the object is satisfactory.
A computer graphics system constructed in accordance with the invention avoids the necessity of solving partial differential equations, which is required in prior art systems which operate in accordance with the shape-from-shading methodology.
Embodiments of the invention also allow the operator to perform conventional computer graphics operations in connection with the object, including rotation and spatial translation of the object to facilitate projection of an image of the object onto an image plane from any of a number of rotational orientations and spatial positions, and scaling or zooming to facilitate enlargement or reduction of the object and/or the image. In such embodiments, the operator can update the shading of the image from any particular three-dimensional rotational and/or translational orientation and position, and from the scaling or zoom setting, as selected by the operator. In addition, embodiments of the invention allow the operator to trim any surface fragment at any moment in time or the updated final object, which may consist of a plurality of such surface fragments, in a conventional manner by projecting two-dimensional trim curves onto the surface of the object. The operator can use the input device, operating in an appropriate drawing mode, to draw these trim curves on the image plane.